#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char cmd[40];
	char client_id[40];
	int i=0;
	memset(client_id,0,40);
	FILE *ipid_fd=fopen("/mnt/nand1-2/mac","r");
	if(ipid_fd!=NULL)
	{	     
		fgets(client_id,40,ipid_fd);
		fclose(ipid_fd);
	}
	else
		sprintf(client_id,"00.0E.C6.87.72.01");
		
	for(i=0;i<strlen(client_id);i++)
	{
		if(client_id[i] == '.')
			client_id[i] = ':';
	}
	
	memset(cmd,0,40);
	strcpy(cmd,"ifconfig eth0 hw ether ");
	strcat(cmd,client_id);
	printf("%s\n",cmd);
	system(cmd);
	
}
